<template>
	<view>
		<uni-list>
		   
		    <uni-list-item v-for="(item,index) in list" :key='index' :title="item.institutionName" :rightText="item.name" link  @click="onClick(item)" ></uni-list-item>
		</uni-list>
        <view v-if="list.length == 0">
        	<u-empty
        	marginTop='100'
        	text='你还没有申请机构哦'
        	        mode="data"
        	>
        	</u-empty>
        </view>
		<view class='fixBtn submites' @click="tapAppply">去申请</view>
		
	</view>
</template>

<script>
	import {getUserinstitutionListApi} from '@/config/api.js'
	export default {
		data() {
			return {
				competitionId:'',
				pageNum:1,
				list:[]
				
			}
		},
		onLoad(option) {
			this.competitionId = option.competitionId
			
		},
		onShow() {
			this.getList()
		},
		methods: {
			 getList(){
				 getUserinstitutionListApi({
					 competitionId:this.competitionId,
					 pageNum:this.pageNum
				 }).then(res=>{
					 console.log(res,'dddd')
					 res.records.forEach(item=>{
						 item.name = item.auditStatus == 1 ?'待审核':item.auditStatus == 2?'审核通过':'审核不通过'
						 item.status = item.auditStatus == 2?true :false
					 })
					  this.list = res.records
				 })
			 },
			 onClick(e){
				 if(e.auditStatus == 2){
					 uni.navigateTo({
					 	url:'/pages/program/management?institutionId='+ e.id + '&competitionId=' + this.competitionId
					 })
				 }
			 },
			 tapAppply(){
				 uni.navigateTo({
				 	url:'/pages/apply/institutions/institutions?competitionId=' + this.competitionId
				 })
			 }
		}
	}
</script>

<style>

</style>
